mainApp.service('messageService', ['$resource',function ($resource){
    
    //消息列表信息
    this.getMessageList = function(success,error){
        return $resource(baseUrl+"/mapi/mmsg/list").get(success,error);
    };
    
    //对话列表信息
    this.getMessageTalkList = function(token,pageIndex,pageSize,success,error){
        return $resource(baseUrl+"/mapi/mmsg/talk/list/:token/:pageIndex/:pageSize",{token:token,pageIndex:pageIndex,pageSize:pageSize}).get(success,error);
    };
    //获取我的未读数量
    this.getNotReadMessageCount = function(success,error){
        return $resource(baseUrl+"/mapi/mmsg/talk/notRead").get(success,error);
    };
    this.deleteTalk = function(token,success,error){
        return $resource(baseUrl+"/mapi/mmsg/deleteTalk/:token",{token:token}).delete(success,error);
    };
    //获取所有的客服人员
    this.getAllCusSerUser = function(success,error){
        return $resource(baseUrl+"/mapi/mmsg/getAllCustomService").get(success,error);
    };
    //获取token
     this.getUsrToken =function(userId,success,error){
    	return $resource(baseUrl+"/mapi/mmsg/getToken/"+ userId).get(success,error);
    }
     //消息发送
     this.addMsg =function(param,success,error){
        return $resource(baseUrl+"/mapi/mmsg/add").save(param,success,error);
    };
    //查询是否存在最新消息
     this.getIfMsg =function(token,success,error){
        return $resource(baseUrl+"/mapi/mmsg/ifMsg/:token",{token:token}).get(success,error);
    };
    //查询是否存在最新消息
     this.getLastMsg =function(token,success,error){
        return $resource(baseUrl+"/mapi/mmsg/lastMsg/:token",{token:token}).get(success,error);
    };
}]);
